package lms.dwr.demo.model;

import org.apache.struts.action.ActionForm;

/**
 * The base model
 * 
 * @author Jeccy.Zhao
 *
 */
public class ModelBase
extends ActionForm 
{
	/**
	 * The serial UID
	 */
	private static final long serialVersionUID = 2665550155018580359L;
	
	/**
	 * The identity of model
	 */
	protected String id = null;
	
	/**
	 * Obtains the identity of the model
	 * 
	 * @return Identity
	 */
	public String getId()
	{
		return id;
	}
	
	/**
	 * Set identity to the model
	 * 
	 * @param id Identify of model
	 */
	public void setId(String id)
	{
		try
		{
			this.id = (id == null || "" == id ||Integer.parseInt(id) < 0) ? null : id;
		} 
		catch (NumberFormatException e)
		{
			this.id = null;
		}
	}
	
}
